package com.zzh.partnersys.ai.service;

import java.util.function.Consumer;

/**
 * 文档解析服务接口
 *
 * @author zzh
 */
public interface DocumentParseService {

    /**
     * 解析文档并存储到 ES
     *
     * @param assistantId 助手ID
     * @param userId      用户ID
     * @param docUrl      文档URL
     * @param docName     文档名称
     * @param docType     文档类型（pdf、md、docx）
     * @param progressCallback 进度回调函数（当前文档索引，总文档数，当前文档名称，状态消息）
     */
    void parseAndStoreDocument(Long assistantId,Long userId, String docUrl, String docName, String docType,
                               Consumer<ParseProgress> progressCallback);

    /**
     * 解析进度信息
     */
    class ParseProgress {
        private final int currentIndex;
        private final int totalCount;
        private final String currentDocName;
        private final String status;
        private final int progress; // 0-100

        public ParseProgress(int currentIndex, int totalCount, String currentDocName, String status, int progress) {
            this.currentIndex = currentIndex;
            this.totalCount = totalCount;
            this.currentDocName = currentDocName;
            this.status = status;
            this.progress = progress;
        }

        public int getCurrentIndex() {
            return currentIndex;
        }

        public int getTotalCount() {
            return totalCount;
        }

        public String getCurrentDocName() {
            return currentDocName;
        }

        public String getStatus() {
            return status;
        }

        public int getProgress() {
            return progress;
        }
    }
}

